<?php


namespace common\validate;

class Version extends BaseValidate
{
    public $rule = [];

    // Fields 验证场景定义
    public function sceneFields()
    {
        return $this;
    }

    // Find 验证场景定义
    public function sceneFind()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array');
    }

    // Select 验证场景定义
    public function sceneSelect()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array')
            ->append('param.page', 'array');
    }

    // Create 验证场景定义
    public function sceneCreate()
    {
        return $this->append("data", "require|array")
            ->append("data.version", "require|array")
            // media / cos_media require_without
            ->append("data.version_check_list", "array")
            ->append("data.review_request", "array");
    }

    // CreateMedia 验证场景定义
    public function sceneCreateMedia()
    {
        return $this
            ->append("data.media", "require|array");
    }

    // CreateCosMedia 验证场景定义
    public function sceneCreateCosMedia()
    {
        return $this
            ->append("data.cos_media", "require|array");
    }

    // Update 验证场景定义
    public function sceneUpdate()
    {
        return $this->append("data", "require|array")
            ->append("data.id", "require");
    }

    // GetTaskVersionForReviewRoom  验证场景定义
    public function sceneGetTaskVersionForReviewRoom()
    {
        return $this->append("param", 'require|array')
            ->append("param.filter.version_id", 'require|integer')
            ->append("param.filter.review_request_id", 'require|integer');
    }

    // SelectTaskVersions 验证场景定义
    public function sceneSelectTaskVersions()
    {
        return $this->append("param", 'require|array');
    }

    // GetTaskEntityActivity 验证场景定义
    public function sceneGetTaskEntityActivity()
    {
        return $this->append('param', 'require')
            ->append('param.filter.id', 'require|integer')
            ->append('param.page', 'array')
            ->append('param.filter.step_id', 'integer');
    }

    // GetTaskEntityActivityStepFilter 验证场景定义
    public function sceneGetTaskEntityActivityStepFilter()
    {
        return $this->append('param.filter.id', 'require|integer');
    }
}
